/*
 * @Description: 支付弹窗初始化JS
 * @Author: zhenqiang.hong
 * @Date: 2019-04-15 10:07:26
 * @Last Modified by: zhenqiang.hong
 * @Last Modified time: 2019-04-15 10:15:31
 */
import PayMode from './PayMode.vue'
import Vue from 'vue'

var PayModeConstructor = Vue.extend(PayMode)
var instance

var PayModeJS = {
  /**
   *
   * @param {Array} tradeNoList 行程编号数组
   * @param {String} amount 行程订单总金额
   * @param {String} goToUrl 回调页面地址
   */
  show: function(tradeNoList, amount, goToUrl) {
    if (!instance) {
      instance = new PayModeConstructor({
        el: document.createElement('div')
      })
    }
    document.body.appendChild(instance.$el)
    instance.tradeNoList = tradeNoList
    instance.amount = amount
    instance.goToUrl = goToUrl
    instance.show()
    instance.getPayList()
  }
}

export default PayModeJS
